import React, {Component} from 'react';
import {
    StyleSheet,
    ScrollView,
    Text,
    View,
    ImageBackground,
    Image,
    Alert,
} from 'react-native';
import {
    Button,
    Flex,
    List,
    WhiteSpace,
    WingBlank,
} from '@ant-design/react-native';
import {getParkingFavoriteList} from '~/api/company';
import Item from '@ant-design/react-native/lib/list/ListItem';
import ScCard from '~/components/sc-card';
export default class Intentioninfo extends Component {
    static navigationOptions = {
        title: '意向客户详情',
        headerTransparent: true,
    };
    constructor() {
        //调用基类的所有的初始化方法
        super();

        // 设置当前组件的属性
        this.state = {
            list: [],
            page_index: 1,
            page_size: 10,
            //列表
            arr: [
                {
                    lcount: 20,
                    numcar: 2,
                    numloc: 1,
                    tjname: '刘先生',
                    adress: '合川区碧桂园开发有限公司',
                    username: '刘先生',
                    phone: '15263489639',
                },
            ],
            xqinfo: [{xq: '华帝邻域', qy: '负一楼', bh: 'B-1212'}],
            linfo: ['拿好礼', '0首付', '返现金', '得汽车', '得车位'],
        };
        getParkingFavoriteList({
            page_index: this.state.page_index,
            page_size: this.state.page_size,
        }).then((r) => {
            if (r.code === 0) {
                this.setState({
                    list: r.data.list,
                });
                // Alert.alert('成功');
            } else {
                Alert.alert('失败');
            }
        });
    }

    render() {
        return (
            <ScrollView style={{flex: 1}}>
                <Image
                    style={styles.images}
                    source={require('~/assets/person/ditu2x.png')}
                />
                <Flex direction={'column'} style={styles.flex}>
                    <Flex style={{height: 72}}>
                        <Flex style={{width: '30%'}}>
                            <Image
                                style={styles.imagestou}
                                source={require('~/assets/person/touxiang2x.png')}
                            />
                        </Flex>
                        <Flex direction={'column'} style={{width: '70%'}}>
                            <Flex
                                style={{width: '100%', paddingRight: 10}}
                                direction={'row'}
                                justify={'between'}
                                align={'start'}>
                                <Text
                                    style={{fontSize: 14, fontWeight: 'bold'}}>
                                    张三
                                </Text>
                                <Text style={{fontSize: 12, color: '#999999'}}>
                                    推荐人:张三
                                </Text>
                            </Flex>
                            <Flex
                                style={{width: '100%', marginTop: 5}}
                                align={'start'}>
                                <Text style={{fontSize: 12, color: '#999999'}}>
                                    电话:15212541251
                                </Text>
                            </Flex>
                        </Flex>
                    </Flex>
                </Flex>
                {/*<View*/}
                {/*    style={{*/}
                {/*        width: '94%',*/}
                {/*        height: 50,*/}
                {/*        backgroundColor: '#FFFFFF',*/}
                {/*        borderRadius: 6,*/}
                {/*        marginTop: 10,*/}
                {/*        marginLeft: '3%',*/}
                {/*    }}>*/}
                {/*    <Flex*/}
                {/*        justify={'around'}*/}
                {/*        style={{width: '100%', marginTop: 15}}>*/}
                {/*        <Flex>*/}
                {/*            <Image*/}
                {/*                style={{width: 11.55, height: 11.55}}*/}
                {/*                source={require('~/assets/confirm/tongyi2x.png')}*/}
                {/*            />*/}
                {/*            <Text*/}
                {/*                style={{*/}
                {/*                    marginLeft: 3.5,*/}
                {/*                    color: '#EC4F46',*/}
                {/*                    fontSize: 12.64,*/}
                {/*                }}>*/}
                {/*                0首付*/}
                {/*            </Text>*/}
                {/*        </Flex>*/}
                {/*        <Flex>*/}
                {/*            <Image*/}
                {/*                style={{width: 11.55, height: 11.55}}*/}
                {/*                source={require('~/assets/confirm/tongyi2x.png')}*/}
                {/*            />*/}
                {/*            <Text*/}
                {/*                style={{*/}
                {/*                    marginLeft: 3.5,*/}
                {/*                    color: '#EC4F46',*/}
                {/*                    fontSize: 12.64,*/}
                {/*                }}>*/}
                {/*                拿好礼*/}
                {/*            </Text>*/}
                {/*        </Flex>*/}
                {/*        <Flex>*/}
                {/*            <Image*/}
                {/*                style={{width: 11.55, height: 11.55}}*/}
                {/*                source={require('~/assets/confirm/tongyi2x.png')}*/}
                {/*            />*/}
                {/*            <Text*/}
                {/*                style={{*/}
                {/*                    marginLeft: 3.5,*/}
                {/*                    color: '#EC4F46',*/}
                {/*                    fontSize: 12.64,*/}
                {/*                }}>*/}
                {/*                返现金*/}
                {/*            </Text>*/}
                {/*        </Flex>*/}
                {/*        <Flex>*/}
                {/*            <Image*/}
                {/*                style={{width: 11.55, height: 11.55}}*/}
                {/*                source={require('~/assets/confirm/tongyi2x.png')}*/}
                {/*            />*/}
                {/*            <Text*/}
                {/*                style={{*/}
                {/*                    marginLeft: 3.5,*/}
                {/*                    color: '#EC4F46',*/}
                {/*                    fontSize: 12.64,*/}
                {/*                }}>*/}
                {/*                抽汽车*/}
                {/*            </Text>*/}
                {/*        </Flex>*/}
                {/*        <Flex>*/}
                {/*            <Image*/}
                {/*                style={{width: 11.55, height: 11.55}}*/}
                {/*                source={require('~/assets/confirm/tongyi2x.png')}*/}
                {/*            />*/}
                {/*            <Text*/}
                {/*                style={{*/}
                {/*                    marginLeft: 3.5,*/}
                {/*                    color: '#EC4F46',*/}
                {/*                    fontSize: 12.64,*/}
                {/*                }}>*/}
                {/*                得车位*/}
                {/*            </Text>*/}
                {/*        </Flex>*/}
                {/*    </Flex>*/}
                {/*</View>*/}
                <View style={styles.list}>
                    {this.state.list.map((item, index) => {
                        return (
                            <WingBlank>
                                <Flex
                                    onPress={() => {
                                        this.props.navigation.push('ParkInfo', {
                                            params: item.ParkingDataID,
                                        });
                                    }}>
                                    <ScCard item={item} key={index} />
                                </Flex>
                            </WingBlank>
                        );
                    })}
                </View>
            </ScrollView>
        );
    }
}
const styles = StyleSheet.create({
    images: {
        width: '100%',
        height: 157,
    },
    flex: {
        width: '94%',
        height: 82,
        backgroundColor: '#FFFFFF',
        marginTop: -70,
        marginLeft: '3%',
        borderRadius: 6,
    },
    imagestou: {
        width: 68,
        height: 68,
        marginTop: 9,
        marginLeft: 14,
    },
});
